Master Dialogflow CX
From Scratch
Build production-grade conversational AI agents using Google's most powerful low-code framework โ no prior experience needed.
12 Lessons
From concepts to production deployment, every topic covered step by step.
2 Full Projects
Pizza ordering bot and banking bot โ real-world scenarios you can extend.
Assignments + Exam
Hands-on assignments after each module and a final certification exam.
What is Dialogflow CX?
Dialogflow CX is Google Cloud's enterprise-grade conversational AI platform. It lets you build sophisticated chatbots and voice bots using a visual flow-based interface โ without writing extensive code. Think of it as the "Figma of chatbot building."
CX vs ES โ Which one?
Dialogflow comes in two flavors: ES (Essentials) for simple linear bots, and CX (Customer Experience) for complex, multi-turn, stateful conversations. This course covers CX exclusively.
Why Dialogflow CX?
| Feature | Dialogflow ES | Dialogflow CX |
|---|---|---|
| Architecture | Intent-based flat | Flow + Page based (stateful) |
| Best for | Simple FAQ bots | Complex multi-turn agents |
| Visual builder | Basic | Advanced flow canvas |
| State management | Limited | Full session state |
| Testing tools | Basic simulator | Conversation replays, CI/CD |
| Pricing | Per request | Per session / per request |
Real-World Use Cases
- ๐ฆ Banking โ account balance, fund transfers, loan applications
- ๐ E-commerce โ order tracking, returns, product Q&A
- โ๏ธ Travel โ flight booking, itinerary changes, check-in
- ๐ฅ Healthcare โ appointment scheduling, symptom triage
- ๐ Contact Centers โ IVR replacement, agent handoff
The Dialogflow CX Console
Everything in this course can be done in the visual console at dialogflow.cloud.google.com. Here's how to get started:
- Go to console.cloud.google.com and create a project
- Enable the Dialogflow API in APIs & Services
- Navigate to Dialogflow CX and create an Agent
- Choose a region (us-central1 recommended for beginners)
- Your agent is ready โ the visual canvas opens automatically
Free Tier
Google Cloud offers a $300 free credit for new accounts. Dialogflow CX also has a free tier: 600 text sessions/month free. Perfect for learning!
Assignment 1: Setup Your Environment
- Create a Google Cloud account (if you don't have one)
- Create a new GCP project named "dfcx-learning"
- Enable the Dialogflow CX API
- Create your first Agent named "MyFirstAgent" in us-central1
- Take a screenshot of the Dialogflow CX canvas with your agent open
Core Concepts
Before building anything, you need a mental model of Dialogflow CX's architecture. It's elegantly hierarchical โ everything nests inside everything else.
The Architecture Hierarchy
Core Components
Agent
The top-level container. One agent per use case (e.g., "Customer Support Bot"). Configured with a language and region.
Flows
Module-like containers grouping related conversations. E.g., "Account Flow", "Order Flow". Each agent has a Default Start Flow.
Pages
The current "state" of a conversation. The bot is always on exactly one page at a time. Pages contain entry fulfillments, routes, and forms.
Intents
What the user wants. Defined by training phrases. E.g., "book a flight" intent matches "I want to fly to Paris" and similar utterances.
Entities
Named pieces of data extracted from utterances. E.g., from "flight to Paris on Monday", extract city=Paris, date=Monday.
Fulfillment
What happens when a route is taken โ send a message, call a webhook, set a parameter, or transition to another page/flow.
How a Conversation Works
Sessions & State
Every conversation is a session. Each session maintains:
- Current Page โ where the user is in the conversation
- Session Parameters โ stored variables (e.g., $session.params.customer_name)
- Flow history โ which flows have been visited
Key Mental Model Shift
In Dialogflow CX, you think in states (pages), not just intents. The same intent can have different behaviors depending on which page the user is currently on. This is the #1 concept beginners miss.
๐ง Quick Check
1. In Dialogflow CX, what represents the "current state" of a conversation?
Flows & Pages
Flows โ Modular Conversation Sections
A Flow is a reusable module for a topic area. Think of it like a function in programming. Large agents use multiple flows to stay organized.
Example Agent: "Telecom Support Bot"
โโโ Default Start Flow โ entry point, routing
โโโ Billing Flow โ all billing questions
โโโ Technical Support Flow โ network/device issues
โโโ Account Management Flow โ profile, password changes
โโโ Cancellation Flow โ retention & cancellationsstructure
Flow Entry Point
Every flow has a Start Page which is automatically entered when a flow is called. This is where you configure the flow's entry message and initial routing.
Pages โ Conversation States
Pages are where the magic happens. Every page can have:
- Entry Fulfillment โ message spoken/shown when entering this page
- Form (Parameters) โ information to collect from user
- Transition Routes โ where to go next based on user input
- Event Handlers โ what to do on no-match, no-input, etc.
A Real Example: Flight Booking
Pages in "Booking Flow":
[Start]
Entry: "Welcome! Where would you like to fly?"
โ user provides origin/destination โ [Collect Dates]
[Collect Dates]
Entry: "What are your travel dates?"
Form: departure_date, return_date
โ form complete โ [Select Seat]
[Select Seat]
Entry: "Window or aisle seat?"
โ user answers โ [Confirmation]
[Confirmation]
Entry: "Your booking is confirmed! โ๏ธ"
โ ENDpage flow
Page Transitions
Pages transition via Routes. A route fires when:
- A specific Intent is matched (e.g., user confirms booking)
- A Condition is true (e.g., all form fields collected)
- An Event occurs (e.g., no-match 3 times โ escalate)
Default Start Flow
Every agent automatically has a Default Start Flow with a Default Welcome Intent. This fires when the user first opens the chat and typically sends a greeting message.
Try the Simulator
Assignment 2: Build Your First Flow
- In your agent, create a new Flow called "Restaurant Booking Flow"
- Add these pages: Greeting โ Collect Party Size โ Collect Date โ Confirmation
- Add Entry Fulfillment messages to each page (make them natural!)
- Connect the pages with simple routes (don't worry about intents yet)
- Test in the Dialogflow simulator by manually triggering transitions
Intents & Entities
Intents โ What the User Wants
An Intent represents the goal behind a user's message. You teach each intent with Training Phrases โ example sentences. Dialogflow's NLU model generalizes from these examples.
Creating a Good Intent
Intent Name: "book.flight"
Training Phrases:
- "I want to book a flight"
- "Can I reserve a seat?"
- "Book me a ticket to New York"
- "I need to fly to London next week"
- "Schedule a flight for tomorrow"
- "Reserve two seats on the 3pm flight"
- "Looking for flights to Paris"
- "How do I buy a plane ticket?"
- "I'd like to travel to Tokyo"
- "Help me book air travel"
(add 10-20 varied phrases for best accuracy)intent config
Training Phrase Best Practices
Add 10โ20 varied phrases. Include formal and informal language. Include phrases with and without entities. Avoid copying the same phrase slightly reworded โ variety is key.
Entities โ What to Extract
Entities extract structured data from free-form text. There are three types:
| Type | Description | Example |
|---|---|---|
| System | Built-in by Google | @sys.date, @sys.number, @sys.city |
| Custom | You define values + synonyms | @seat-type: window, aisle, middle |
| Regex | Pattern-based extraction | @booking-id: BK[0-9]{6} |
Custom Entity Example
Entity: @pizza-size
Values:
- small (synonyms: tiny, personal)
- medium (synonyms: regular, standard)
- large (synonyms: big, family, jumbo)
- extra-large (synonyms: XL, extra large, huge)
Usage in training phrase:
"I want a [large](@pizza-size) pepperoni pizza"
โ extracts: pizza-size = "large"entity config
Annotating Training Phrases
When you type a training phrase in the console and highlight a word, Dialogflow lets you tag it with an entity. This creates a parameter automatically.
Training phrase: "Book a flight from Chicago to Miami on Friday"
Annotations:
"Chicago" โ @sys.geo-city โ parameter: origin_city
"Miami" โ @sys.geo-city โ parameter: destination_city
"Friday" โ @sys.date-period โ parameter: travel_dateannotation
System Entities Cheat Sheet
| Entity | Matches | Example |
|---|---|---|
| @sys.number | Numbers | "three", "3", "fifteen" |
| @sys.date | Dates | "tomorrow", "March 5th", "next Monday" |
| @sys.time | Times | "3pm", "noon", "at 15:00" |
| @sys.email | Emails | "user@example.com" |
| @sys.phone-number | Phone numbers | "+1 555-0100" |
| @sys.currency-name | Currency | "dollars", "USD", "euros" |
๐ง Quiz: Intents & Entities
1. Which entity type should you use to extract a phone number from user input?
2. How many training phrases is recommended per intent for good NLU accuracy?
Assignment 3: Intents & Entities
- Create intent "order.pizza" with 15 varied training phrases
- Create intent "cancel.order" with 10 training phrases
- Create custom entity @pizza-topping with 5 values, each with 2 synonyms
- Annotate 5 of your "order.pizza" training phrases with @pizza-topping and @sys.number
- Test in the simulator: type "I want 2 large margherita pizzas" and verify entity extraction
Fulfillment & Webhooks
What is Fulfillment?
Fulfillment is what happens when a route fires. It can be one or more of:
- ๐ Static Response โ send a text/card/chip response
- ๐ Parameter Preset โ set a session parameter value
- ๐ Webhook Call โ call an external API
- โฉ๏ธ Transition โ move to another page/flow
Response Types
// TEXT RESPONSE
"Your order has been placed! ๐"
// RICH RESPONSE (chips)
Text: "How can I help you?"
Suggestion chips: ["Check order", "Cancel order", "Talk to agent"]
// CUSTOM PAYLOAD (for frontend)
{
"richContent": [[{
"type": "chips",
"options": [
{"text": "Order Pizza"},
{"text": "Track Order"}
]
}]]
}response types
Webhooks โ The Power Feature
Webhooks allow Dialogflow CX to call your backend service in real time. This enables dynamic responses, database lookups, and API integrations.
Webhook Request Format
// DIALOGFLOW SENDS THIS TO YOUR ENDPOINT:
POST https://your-server.com/webhook
{
"detectIntentResponseId": "abc-123",
"intentInfo": {
"lastMatchedIntent": "projects/.../intents/order-pizza",
"parameters": {
"pizza-size": { "stringValue": "large" },
"pizza-topping": { "stringValue": "pepperoni" }
}
},
"sessionInfo": {
"session": "projects/.../sessions/session-123",
"parameters": {
"customer_name": "Amir",
"loyalty_points": 250
}
},
"text": "I want a large pepperoni pizza"
}webhook request
Webhook Response Format
// YOUR SERVER RETURNS THIS:
{
"fulfillment_response": {
"messages": [{
"text": {
"text": ["Order confirmed! Your large pepperoni pizza will arrive in 30 mins."]
}
}]
},
"session_info": {
"parameters": {
"order_id": "ORD-98765",
"estimated_time": "30 minutes"
}
}
}webhook response
Simple Python Webhook (Cloud Functions)
import functions_framework
import json
@functions_framework.http
def dialogflow_webhook(request):
req = request.get_json()
# Get parameters from session
params = req.get('sessionInfo', {}).get('parameters', {})
pizza_size = params.get('pizza-size', 'medium')
topping = params.get('pizza-topping', 'cheese')
# Business logic
prices = {'small': 8, 'medium': 12, 'large': 16}
price = prices.get(pizza_size, 12)
order_id = "ORD-" + str(hash(pizza_size+topping))[-5:]
return {
"fulfillment_response": {
"messages": [{
"text": {
"text": [f"โ
Order #{order_id}: {pizza_size} {topping} pizza - ${price}. Ready in 25 mins!"]
}
}]
},
"session_info": {
"parameters": {
"order_id": order_id,
"order_price": price
}
}
}python webhook
Webhook Timeout
Dialogflow CX has a 5-second webhook timeout. Keep your webhook responses fast. Use async patterns for slow operations and return a "processing" message first if needed.
Assignment 4: Build a Webhook
- Deploy the Python webhook above to Google Cloud Functions (or use webhook.site for testing)
- Register your webhook URL in Dialogflow CX: Agent Settings โ Webhooks
- Add the webhook to your pizza order intent's fulfillment
- Test that ordering a pizza returns the dynamic order ID and price
- Extend the webhook to also handle "cancel.order" intent โ return "Order cancelled successfully."
State Handlers
What are State Handlers?
State handlers are rules attached to a Page or Flow that determine what happens next. There are 4 types:
Intent Routes
Fires when a specific intent is matched. The most common handler โ "when user says X, do Y."
Condition Routes
Fires when a parameter-based condition is true. E.g., $session.params.order_total > 50
Form Completion
Fires when all required parameters in a form have been collected from the user.
Event Handlers
Fires on system events: sys.no-match, sys.no-input, WELCOME, custom events.
Condition Route Examples
// Route fires if order total is over $50 (add free delivery)
Condition: $session.params.order_total > 50
Action: Set delivery_fee = 0, say "Free delivery on your order!"
// Route fires if user is a premium member
Condition: $session.params.membership_tier = "premium"
Action: Transition to PremiumServicesPage
// Route fires if all form parameters collected
Condition: $page.params.status = "FINAL"
Action: Transition to ConfirmationPage
// Combining conditions
Condition: $session.params.age >= 18 AND $session.params.country = "US"
Action: Show age-restricted content pageconditions
Event Handlers โ Error Recovery
Event handlers are crucial for graceful failure handling:
Event: sys.no-match-1 โ "Sorry, I didn't understand. Can you rephrase?"
Event: sys.no-match-2 โ "I'm still having trouble. Here are some options..."
Event: sys.no-match-default โ Transfer to live agent
Event: sys.no-input-1 โ "Are you still there?"
Event: sys.no-input-default โ "I'll end the session now. Goodbye!"event handlers
Route Priority
When multiple routes could fire, Dialogflow CX evaluates them in order: Intent Routes first, then Condition Routes, then Event Handlers. Order your routes intentionally โ the first matching route wins.
Scope: Page vs. Flow Handlers
| Level | Scope | Use When |
|---|---|---|
| Page Handler | Only fires on this specific page | Page-specific logic (e.g., "confirm order" only on order page) |
| Flow Handler | Fires anywhere within this flow | Global escapes (e.g., "cancel" intent reachable from any page) |
| Start Page Handler | Fires before any page in the flow | Entry-level routing, authentication checks |
๐ง Quiz: State Handlers
You want the user to be able to say "cancel" from ANY page in your "Order Flow". Where should you add the cancel intent route?
Parameters & Forms
Session Parameters
Parameters are variables stored in the session. They persist across the entire conversation and can be read/written anywhere.
// REFERENCE SYNTAX
$session.params.customer_name // from session
$intent.params.pizza_size // from current intent
$page.params.status // form status
$flow.params.flow_variable // from current flow
// IN RESPONSE TEXT (interpolation)
"Hello $session.params.customer_name! Your order is confirmed."
โ renders as: "Hello Amir! Your order is confirmed."parameter syntax
Forms โ Collecting Multiple Parameters
A Form is a set of parameters a page needs to collect before proceeding. Dialogflow CX automatically prompts the user for any missing parameters.
Page: "Collect Flight Details"
Form Parameters:
- origin_city (required) โ @sys.geo-city
Prompt: "Where are you flying from?"
- destination_city (required) โ @sys.geo-city
Prompt: "And where are you flying to?"
- travel_date (required) โ @sys.date
Prompt: "What's your travel date?"
- num_passengers (optional) โ @sys.number
Prompt: "How many passengers?"
// When ALL required params are filled:
$page.params.status = "FINAL"
โ Condition route fires โ transition to next pageform config
Form Reprompt โ Handling Invalid Input
Parameter: travel_date
Initial prompt: "What date would you like to travel?"
Reprompt event handlers:
sys.no-match-1: "I didn't catch that. Please say a date like 'March 15' or 'next Friday'."
sys.no-match-2: "Let me try again โ what date works for you? Example: 'April 1st'"
sys.no-match-default: "I'm having trouble with the date. Let me connect you with an agent."reprompt
Parameter Presets
You can set parameters programmatically in fulfillment without collecting from user:
// In a route's fulfillment โ Parameter Presets:
loyalty_tier = "gold"
session_start_time = "2024-01-15T10:30:00"
agent_name = "Max"
// Conditional preset based on other params:
discount_pct = IF($session.params.loyalty_tier == "gold", 15, 0)parameter presets
Inaccessible Parameters
$intent.params only contains parameters from the current intent match. Once you transition to a new page or the intent changes, always copy important values to $session.params so they persist.
Assignment 5: Build a Multi-Step Form
- Create a page called "Collect Reservation Info"
- Add a form with 4 parameters: customer_name, party_size, date, time
- Write custom prompts for each parameter (natural language)
- Add reprompt handlers for each parameter (at least 2 reprompts)
- On form completion, transition to a Confirmation page that says: "Thanks [name]! Table for [size] on [date] at [time] โ confirmed!"
Route Groups & Versions
Route Groups โ Reusable Logic
Route Groups let you define a set of routes once and reuse them across multiple pages. Perfect for global commands like "help", "cancel", "repeat", or "talk to agent".
Route Group: "Global Commands"
Routes:
- Intent: talk.to.agent โ Transition to [Live Agent Page]
- Intent: repeat.last โ Fulfillment: repeat last response
- Intent: main.menu โ Transition to [Main Menu Page]
- Intent: goodbye โ Fulfillment: "Goodbye!" โ END
// Apply to multiple pages in one click
// Instead of adding these routes to every page manuallyroute group
Environments & Versions
Versions let you snapshot your agent at a point in time. Environments let you run different versions simultaneously.
| Concept | Description | Use Case |
|---|---|---|
| Draft | Working version (always editable) | Development |
| Version | Named snapshot (immutable) | "v1.2.0-stable" |
| Environment | Named deployment target | Development, Staging, Production |
Typical workflow:
1. Edit in Draft
2. Create Version: "v2.3.0" with description
3. Deploy to Staging environment โ test
4. Deploy to Production environment โ go live
5. If issues โ rollback to previous version in secondsdeployment workflow
CI/CD Integration
# Deploy version via gcloud CLI
gcloud dialogflow cx versions create \
--agent=AGENT_ID \
--flow=START_FLOW_ID \
--display-name="v2.3.0" \
--description="Added pizza customization flow"
# Deploy to environment
gcloud dialogflow cx environments deploy \
--environment=ENVIRONMENT_ID \
--flow-version=FLOW_VERSION_IDgcloud cli
Project: Build a Pizza Ordering Bot ๐
Let's build a complete pizza ordering bot from scratch, applying everything we've learned.
Architecture Overview
PIZZA BOT ARCHITECTURE
========================
Agent: "PizzaBot"
โ
โโโ Default Start Flow
โ โโโ Start Page
โ โโโ WELCOME โ Greeting Page
โ โโโ Intent: start.ordering โ Order Flow
โ
โโโ Order Flow
โโโ Start Page (entry)
โโโ Choose Pizza Page (form: size, crust, toppings)
โโโ Customize Page (extras, sauce)
โโโ Confirm Order Page (show summary, confirm/edit)
โโโ Payment Page (collect payment method)
โโโ Order Confirmed Page (webhook: submit order)
Route Groups:
- Global: cancel, help, restartarchitecture
Step 1: Create the Entities
@pizza-size: small, medium, large, xl
@pizza-crust: thin, thick, stuffed, gluten-free
@pizza-topping: pepperoni, mushroom, onion, pepper,
olive, bacon, chicken, extra-cheese
@payment-type: card, cash, apple-pay, google-payentities
Step 2: Create the Intents
order.pizza โ "I want to order a pizza", "Let's get a pizza"
confirm.order โ "Yes", "Confirm", "That's right", "Place the order"
edit.order โ "Change my order", "Actually...", "Wait, I want..."
cancel.order โ "Cancel", "Never mind", "Stop"
ask.for.help โ "Help", "What can you do?", "Options"
provide.pizza.size โ "Large please", "Make it medium"
provide.toppings โ "Add pepperoni and mushrooms"intents
Step 3: Build the "Choose Pizza" Page
Page: "Choose Pizza"
Entry Fulfillment: "Great! Let's build your perfect pizza. ๐"
Form Parameters:
pizza_size โ @pizza-size
Prompt: "What size? Small ($8), Medium ($12), Large ($16), or XL ($20)?"
pizza_crust โ @pizza-crust
Prompt: "What crust? Thin, thick, stuffed, or gluten-free?"
pizza_toppings โ @pizza-topping (list)
Prompt: "Choose your toppings: pepperoni, mushroom, onion, pepper, olive, bacon, chicken, or extra cheese?"
Condition Route (form complete):
$page.params.status = "FINAL" โ Transition to [Confirm Order Page]page config
Step 4: Confirmation Page
Page: "Confirm Order"
Entry Fulfillment:
"Here's your order summary:
๐ $session.params.pizza_size $session.params.pizza_crust pizza
Toppings: $session.params.pizza_toppings
Total: $session.params.calculated_price
Ready to place your order?"
Chips: ["โ
Yes, place order", "โ๏ธ Edit order", "โ Cancel"]
Routes:
Intent: confirm.order โ Webhook (submit) โ [Order Confirmed Page]
Intent: edit.order โ Transition to [Choose Pizza Page]
Intent: cancel.order โ Fulfillment: "Order cancelled." โ ENDconfirmation page
Live Demo
Assignment 6: Complete Pizza Bot
- Build the complete agent architecture described above in Dialogflow CX
- Implement all 4 entities and 7 intents with proper training phrases
- Build all 6 pages with proper forms, routes, and entry fulfillments
- Add a webhook that calculates the price dynamically based on size
- Add a "Global Commands" Route Group with cancel, help, and restart
- Add no-match handlers on every page that re-prompts helpfully
Project: Banking Support Bot ๐ฆ
A more complex agent with authentication, multiple flows, and conditional routing โ a production-like scenario.
Architecture
BANKING BOT ARCHITECTURE
=========================
Agent: "BankBot"
โ
โโโ Default Start Flow
โ โโโ Authenticate User Page โ verify account number
โ โโโ Main Menu Page โ routing hub
โ
โโโ Account Flow
โ โโโ Check Balance Page โ webhook: get balance
โ โโโ Recent Transactions Page โ webhook: get transactions
โ โโโ Account Details Page
โ
โโโ Transfer Flow
โ โโโ Enter Amount Page โ form: amount, account
โ โโโ Confirm Transfer Page
โ โโโ Transfer Complete Page โ webhook: execute transfer
โ
โโโ Support Flow
โ โโโ Report Card Lost Page
โ โโโ Dispute Transaction Page
โ โโโ Live Agent Transfer Page
โ
โโโ Global Route Group
โโโ "main menu", "help", "logout"architecture
Authentication Pattern
Page: "Authenticate User"
Entry: "Welcome to SecureBank. Please enter your account number."
Form:
account_number โ @sys.number (6 digits)
On form complete โ Webhook: verify_account
IF webhook returns verified=true:
Set session.params.authenticated = true
Set session.params.customer_name = [from webhook]
Transition to [Main Menu]
IF webhook returns verified=false:
Increment session.params.auth_attempts
IF auth_attempts >= 3 โ Transition to [Locked Account Page]
ELSE โ Reprompt: "Account not found. Please try again."auth page
Conditional Routing Based on Authentication
// On Start Page โ check auth before anything
Route 1 (highest priority):
Condition: $session.params.authenticated != true
Action: Transition to [Authenticate User Page]
Route 2:
Intent: check.balance
Condition: $session.params.authenticated = true
Action: Transition to Account Flow โ Check Balance Page
// This pattern prevents unauthenticated access to any sensitive pageauth guard
Transfer Flow โ Advanced Form
Page: "Enter Transfer Details"
Form:
transfer_amount โ @sys.number
Prompt: "How much would you like to transfer?"
Validation webhook: check sufficient funds
recipient_account โ @sys.number
Prompt: "Enter the recipient's account number."
transfer_note โ @sys.any (optional)
Prompt: "Any note for this transfer? (optional, say 'skip' to continue)"
On form complete:
Condition: $session.params.transfer_amount > $session.params.account_balance
โ Fulfillment: "Insufficient funds. Your balance is $X."
โ Transition back to [Enter Transfer Details]
Condition: $session.params.transfer_amount <= $session.params.account_balance
โ Transition to [Confirm Transfer Page]transfer form
Assignment 7: Banking Bot
- Build the complete banking bot architecture (all 4 flows)
- Implement the authentication pattern with account number verification
- Build the transfer flow with balance validation
- Add a mock webhook that simulates account balance lookup (hardcode a few accounts)
- Add the "report card lost" page that collects: reason, last known location, new card needed (y/n)
- Add a "Talk to Agent" option accessible from anywhere that summarizes the conversation and passes to a live agent
Testing & Debugging
The Test Console
Dialogflow CX has a built-in test simulator accessible from the right panel. It shows:
- Current page and flow
- Matched intent and confidence score
- Extracted parameters and their values
- Which route was triggered
- Webhook request/response details
Conversation Replay
A powerful CX feature โ record test conversations and replay them to detect regressions after changes.
// Test conversation format (YAML)
test_cases:
- display_name: "Complete Pizza Order"
conversation_turns:
- user_input: "I want to order a pizza"
virtual_agent_output:
triggered_intent: "order.pizza"
current_page: "Choose Pizza"
- user_input: "Large pepperoni"
virtual_agent_output:
current_page: "Choose Pizza"
session_parameters:
pizza_size: "large"
pizza_toppings: ["pepperoni"]test case yaml
Common Issues & Fixes
| Issue | Symptom | Fix |
|---|---|---|
| Wrong intent matched | Bot goes to wrong page | Add more varied training phrases; check for overlapping intents |
| Entity not extracted | Parameter is null | Annotate more training phrases; check entity type is correct |
| Form never completes | Bot keeps asking same question | Check parameter entity type matches user input format |
| Webhook timeout | Error response after 5s | Optimize backend; add async pattern with quick ack |
| Routes not firing | No transition happens | Check route order; verify condition syntax; check intent is active on this page |
Validation Tool
// Run validation before deploying:
gcloud dialogflow cx agents validate --agent=AGENT_ID
// Returns warnings like:
// WARNING: Intent 'order.pizza' has only 3 training phrases (minimum: 10)
// WARNING: Page 'Confirm Order' has no no-match handler
// ERROR: Webhook 'process-order' URL returns 404validation
Final Exam ๐
Complete the following exam to earn your Dialogflow CX completion certificate. You need 14/20 correct (70%) to pass.
๐ Final Exam โ Dialogflow CX
1. What is the hierarchy order in Dialogflow CX from top to bottom?
2. What does $page.params.status = "FINAL" indicate?
3. Which system entity extracts "next Monday" from user input?
4. What is the webhook timeout limit in Dialogflow CX?
5. To make a "help" intent available from ANY page in a flow, you should add it to:
6. Which parameter reference retrieves a value set in the current session?
7. What fires when a user doesn't respond to a bot prompt (voice channel)?
8. Dialogflow CX differs from Dialogflow ES primarily because CX uses:
9. What is the correct webhook response field to update session parameters?
10. How many training phrases are recommended for good intent accuracy?